{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nexport default (function (stretch) {\n  var _React$useState = React.useState({\n      width: 0,\n      height: 0\n    }),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    targetSize = _React$useState2[0],\n    setTargetSize = _React$useState2[1];\n  function measureStretch(element) {\n    var tgtWidth = element.offsetWidth,\n      tgtHeight = element.offsetHeight;\n    var _element$getBoundingC = element.getBoundingClientRect(),\n      width = _element$getBoundingC.width,\n      height = _element$getBoundingC.height; // Rect is more accurate than offset, use if near\n\n    if (Math.abs(tgtWidth - width) < 1 && Math.abs(tgtHeight - height) < 1) {\n      tgtWidth = width;\n      tgtHeight = height;\n    }\n    setTargetSize({\n      width: tgtWidth,\n      height: tgtHeight\n    });\n  } // Merge stretch style\n\n  var style = React.useMemo(function () {\n    var sizeStyle = {};\n    if (stretch) {\n      var width = targetSize.width,\n        height = targetSize.height; // Stretch with target\n\n      if (stretch.indexOf('height') !== -1 && height) {\n        sizeStyle.height = height;\n      } else if (stretch.indexOf('minHeight') !== -1 && height) {\n        sizeStyle.minHeight = height;\n      }\n      if (stretch.indexOf('width') !== -1 && width) {\n        sizeStyle.width = width;\n      } else if (stretch.indexOf('minWidth') !== -1 && width) {\n        sizeStyle.minWidth = width;\n      }\n    }\n    return sizeStyle;\n  }, [stretch, targetSize]);\n  return [style, measureStretch];\n});","map":{"version":3,"names":["_slicedToArray","React","stretch","_React$useState","useState","width","height","_React$useState2","targetSize","setTargetSize","measureStretch","element","tgtWidth","offsetWidth","tgtHeight","offsetHeight","_element$getBoundingC","getBoundingClientRect","Math","abs","style","useMemo","sizeStyle","indexOf","minHeight","minWidth"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-trigger/es/Popup/useStretchStyle.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nexport default (function (stretch) {\n  var _React$useState = React.useState({\n    width: 0,\n    height: 0\n  }),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      targetSize = _React$useState2[0],\n      setTargetSize = _React$useState2[1];\n\n  function measureStretch(element) {\n    var tgtWidth = element.offsetWidth,\n        tgtHeight = element.offsetHeight;\n\n    var _element$getBoundingC = element.getBoundingClientRect(),\n        width = _element$getBoundingC.width,\n        height = _element$getBoundingC.height; // Rect is more accurate than offset, use if near\n\n\n    if (Math.abs(tgtWidth - width) < 1 && Math.abs(tgtHeight - height) < 1) {\n      tgtWidth = width;\n      tgtHeight = height;\n    }\n\n    setTargetSize({\n      width: tgtWidth,\n      height: tgtHeight\n    });\n  } // Merge stretch style\n\n\n  var style = React.useMemo(function () {\n    var sizeStyle = {};\n\n    if (stretch) {\n      var width = targetSize.width,\n          height = targetSize.height; // Stretch with target\n\n      if (stretch.indexOf('height') !== -1 && height) {\n        sizeStyle.height = height;\n      } else if (stretch.indexOf('minHeight') !== -1 && height) {\n        sizeStyle.minHeight = height;\n      }\n\n      if (stretch.indexOf('width') !== -1 && width) {\n        sizeStyle.width = width;\n      } else if (stretch.indexOf('minWidth') !== -1 && width) {\n        sizeStyle.minWidth = width;\n      }\n    }\n\n    return sizeStyle;\n  }, [stretch, targetSize]);\n  return [style, measureStretch];\n});"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,gBAAgB,UAAUC,OAAO,EAAE;EACjC,IAAIC,eAAe,GAAGF,KAAK,CAACG,QAAQ,CAAC;MACnCC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACEC,gBAAgB,GAAGP,cAAc,CAACG,eAAe,EAAE,CAAC,CAAC;IACrDK,UAAU,GAAGD,gBAAgB,CAAC,CAAC,CAAC;IAChCE,aAAa,GAAGF,gBAAgB,CAAC,CAAC,CAAC;EAEvC,SAASG,cAAc,CAACC,OAAO,EAAE;IAC/B,IAAIC,QAAQ,GAAGD,OAAO,C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